package com.movieproject.testing;

import java.util.ArrayList;
import java.util.List;

import com.movieproject.daos.InventoryDAO;
import com.movieproject.daos.imp.InventoryDAOImp;
import com.movieproject.dataobjects.User;
import com.movieproject.dataobjects.User;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;  
import org.hibernate.cfg.Configuration; 

public class Test {

    public static void main(String[] args) {
	SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
	Session session = sessionFactory.openSession();
	session.beginTransaction();
	User movie = (User) session.get(User.class, 10);
	
	Query query = session.createQuery("from User");
	//query.setParameter("thing", "Comedy");
	List<?> list = query.list();
	ArrayList<User> movielist = new ArrayList<User>();
	for(Object o : list) movielist.add((User) o);
	    
	session.getTransaction().commit();
	
	for(User m : movielist) System.out.println(m.getUserID());
    }
}
